import java.util.Arrays;
import java.util.List;

public class problem52 {
    public static void main(String[] args) {
        Long number = 1L;
        while (true) {
            List<Long> pandigitals = Arrays.asList(ProjectEuler.getPandigitals(number));
            if (pandigitals.contains(number * 2) &&
                pandigitals.contains(number * 3) &&
                pandigitals.contains(number * 4) &&
                pandigitals.contains(number * 5) &&
                pandigitals.contains(number * 6)) {
                System.out.println(number);
                break;
            }
        }
    }
}
